﻿#ifndef TABLE_ROW_HOVER_H
#define TABLE_ROW_HOVER_H

#include <QTableView>
#include <QMouseEvent>
#include <QEvent>
#include <QStyledItemDelegate>

class RowHoverDelegate : public QStyledItemDelegate
{
    Q_OBJECT
public:
    explicit RowHoverDelegate(QObject *parent = 0);

    bool setHoverRow(int row);
    int  getHoverRow();

protected:
    void paint(QPainter *painter, const QStyleOptionViewItem &option,
               const QModelIndex &index) const;

private:
    int m_hovered_row;
};

class RowHoverTableView : public QTableView
{
    Q_OBJECT

public:
    explicit RowHoverTableView(QWidget *parent = 0);

protected:
    void mouseMoveEvent(QMouseEvent *event);
    void leaveEvent(QEvent *event);
    void wheelEvent(QWheelEvent *event);
};

#endif // TABLE_ROW_HOVER_H
